<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <meta name="author" content="Flying hormone" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta charset="UTF-8">
        <link rel="stylesheet" href="../css/media.css" />
        <link rel="stylesheet" href="../css/mui.min.css" />
        <link rel="stylesheet" href="../css/head_foot.css" />
        <script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="../js/jquery.Query.js" ></script>
        <script type="text/javascript" src="../js/jquery-cookie.js"></script>
        <script type="text/javascript" src="../js/mui.min.js"></script>
        <script type="text/javascript" src="../js/appcan.js"></script>
        <script type="text/javascript" src="../js/appcan.control.js"></script>
        <script type="text/javascript" src="../js/common.js" ></script>
		<title>母婴列表</title>
		<style>
            
            .quyu{ position: relative; height: auto; overflow: hidden; font-size: 1em; line-height: 3em}
            #quyu{ height: auto; overflow: hidden;}
            #quyu>a{ font-size: 1em; display: block; border-bottom: 0.1em solid #ccc; padding: 0 2em 0 0.5em; color: #787878;
                height: 3em;
                width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            .quyu .quyu_zi{ }
            .quyu_zi a{ padding: 0.1em 0.5em; margin-right: 0.5em; margin-top: 0.5em; border-radius: 5px;background: #fff; color: #ff3366; border: 1px solid #ff3366;;
                display: inline-block;
                height: 1.6em;
                line-height: 1.4em; 
            }
            .quyu_zi .active{background: #ff3366; border-radius:0.1em; color: #fff; 
                display: inline-block;
                height: 1.6em;
                line-height: 1.4em; 
            }
            .xiangxia{ position: absolute; top: 1em; right: 0.625em; z-index: -100; }
            .tu_2 a{
                display: block;
                height: 11.5em;
            }
            .tu_2 img{
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        </style>
	</head>

	<body>
		<header>
			<a><span class="leftleft"></span></a>
			<h1>母婴列表</h1>
			<a class="xiaoxi3" href="javascript:;" onclick="openUrl('../user/fabumoshi.html?type=D','fabumoshi')">发布</a>
		</header>
		<section class="quyu">
			<div id="quyu">
                <a class="xianyin"></a>
                <span class="bottombottom xiangxia xianyin"></span>
                <div class="quyu_zi" style="display: none;padding: 0 0.5em;line-height: 2em;">
                    
                </div>
            </div>
		</section>
		<div id="list">
		    
		</div>

		<footer>
			<nav class="mui-bar mui-bar-tab">
				<a class="action" href="javascript:;" id="tcIndex">
                    <img src="../img/shouye.png" />
                    <span class="mui-tab-label">首页</span>
                </a>
                <a href="javascript:;" id="myfabu">
                    <img src="../img/fabu2.png" />
                    <span class="mui-tab-label">发布</span>
                </a>
                <a href="javascript:;" id="myInfo">
                    <img src="../img/mine.png" />
                    <span class="mui-tab-label">我的</span>
                </a>
			</nav>
		</footer>
        <script>
            $(function(){
                appcan.ready(function(){
                    appcan.window.setBounce({
                        bounceType:0,
                        startPullCall:function(type){
                        },
                        downEndCall:function(type){
                            window.location.reload();
                        },
                        upEndCall:function(type){
                            appcan.window.resetBounceView(type);
                        },
                        color:"#fff"
                    })
                })
                //列表
                babyList("");
                //查询 分类
                appcan.ajax({
                    type:"get",
                    url:host+"/getAreaByName.json?cityName="+appcan.locStorage.getVal("ipcity"),
                    dataType:"json",
                    contentType: "application/json",
                    success : function(dataResult) {
                        var actStr = '';
                        // 获取区域数据
                        for(var i=0;i<dataResult.data.length;i++){
                            actStr +='<a>'+dataResult.data[i].cityname+'</a>';
                        }
                        $(".quyu_zi").html(actStr);
                        
                        // 绑定已选
                        var ccc = "";
                        for(var i=($(".quyu_zi .active").length); i>0; i--){
                           ccc = $(".quyu_zi .active").eq(i-1).text() + (ccc.length == 0 ? "" : ("," + ccc));
                           $("#quyu>a").text("区域："+ccc);
                        };
                        if($(".quyu_zi .active").length ==0){
                            $("#quyu>a").text("请选择区域");
                        }
                        // 选择事件
                        $(".xianyin").click(function(){
                           if($(".quyu_zi").css("display") == "none"){
                               $(".quyu_zi").show();
                           }else{
                               $(".quyu_zi").hide();
                           };
                        });
                        $(".quyu_zi a").click(function(){
                           if($(this).hasClass("active")){
                               $(this).removeClass("active");
                               $("#quyu>a").text(" ");
                               console.log($(".quyu_zi .active").length);
                               var ccc = "";
                               for(var i=($(".quyu_zi .active").length); i>0; i--){
                                   ccc = $(".quyu_zi .active").eq(i-1).text() + (ccc.length == 0 ? "" : ("," + ccc));
                                   $("#quyu>a").text("区域："+ccc);
                               };
                               if($(".quyu_zi .active").length ==0){
                                   $("#quyu>a").text("请选择区域");
                                   babyList("");
                               }else{
                                   babyList(ccc);
                               };
                           }else{
                               $(".quyu_zi a").removeClass("active");
                               $(this).addClass("active");
                               $("#quyu>a").text(" ");
                               var ccc = "";
                               console.log($(".quyu_zi .active").length);
                               for(var i=$(".quyu_zi .active").length; i>0; i--){
                                   ccc = $(".quyu_zi .active").eq(i-1).text() + (ccc.length == 0 ? "" : ("," + ccc));
                                   $("#quyu>a").text("区域："+ccc);
                               };
                               if($(".quyu_zi .active").length ==0){
                                   $("#quyu>a").text("请选择区域");
                                   babyList("");
                               }else{
                                   babyList(ccc);
                               };
                           }
                           $(".quyu_zi").hide();
                        });
                    }
                })
            })
            function babyList(param){
                var baseParam1 = {'actType':'D1,D2','addName':appcan.locStorage.getVal("ipcity"),'region':param,'orderBy':'amount'}
                var param1 = serializePageJson(1,100,baseParam1);
                appcan.ajax({
                    type:"post",
                    url:host+"/getActiveList.json",
                    data:param1,
                    dataType:"json",
                    contentType: "application/json",
                    success : function(dataResult) {
                        var dataList = dataResult.data.dataList;
                        var actStr = "";
                        for(var i=0;i<dataList.length;i++){
                            if(dataList[i].actType == 'D1'){
                                actStr += '<section class="tu_2"><div class=\"bigtu\"><a href="javascript:;" onclick="openUrl(\'info_goods.html?actId='+dataList[i].id+'\',\'info_goods\')"><img src="'+hostIp+dataList[i].mainPic+'" onerror="javascript:src=\'../img/lizi2.png\'"/></a></div></section>';
                            }else{
                                actStr+='<section class="same_city_search"><div><ul class="list_a">';
                                actStr += '<li>';
                                actStr += '<a href="javascript:;" onclick="openUrl(\'info_goods.html?actId='+dataList[i].id+'\',\'info_goods\')">';
                                actStr += '<div><img src="'+hostIp+dataList[i].mainPic+'" onerror="javascript:src=\'../img/lizi1.png\'"></div>';
                                actStr += '<div><p>'+dataList[i].shopName;
                                actStr += '</p>'+dataList[i].summary+'';
                                actStr += '<i>'+dataList[i].createTime+'</i>';
                                actStr += '</div></a></li>';
                                actStr+='</ul></div></section>';
                            }
                        }
                        $("#list").html(actStr);
                    }
                })
            }
        </script>
	</body>

</html>